package us.fourdesign.zptjob.DataHolder;

import java.util.Date;

import org.json.JSONException;
import org.json.JSONObject;

import us.fourdesign.zptjob.http.Response;

public class JobInfo extends Response{
	private String id;
	private String bio;
	private Date reg_end_at;
	private Date begin_at;
	private Date end_at;
	private int benifit;
	private int count;
	private String require;
	private ProviderInfo provider;
	private LocationInfo location;
	private CategoryInfo category;


	public JobInfo(JSONObject json) {
		
		try {
			id = json.getString("id");
			bio = json.getString("bio");
			reg_end_at = parseDate(json.getString("reg_end_at"), "EEE MMM dd HH:mm:ss z yyyy");
			begin_at = parseDate(json.getString("begin_at"), "EEE MMM dd HH:mm:ss z yyyy");
			end_at = parseDate(json.getString("end_at"), "EEE MMM dd HH:mm:ss z yyyy");
			benifit = json.getInt("benifit");
			count = json.getInt("count");
			provider = new ProviderInfo(json.getJSONObject("provider"));
			location = null;
			category = new CategoryInfo(json.getJSONObject("category"));
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	/**
	 * 返回兼职信息ID
	 * 
	 * @return: 兼职信息ID
	 */
	public String getId() {
		return id;
	}

	/**
	 * 返回兼职信息简介
	 * 
	 * @return: 返回兼职信息简介
	 */
	public String getBio() {
		return bio;
	}

	/**
	 * 返回兼职报名截至时间
	 * 
	 * @return: 返回兼职报名截至时间
	 */
	public Date getReg_end_at() {
		return reg_end_at;
	}

	/**
	 * 返回兼职开始时间
	 * 
	 * @return: 返回兼职开始时间
	 */
	public Date getBegin_at() {
		return begin_at;
	}

	/**
	 * 返回兼职结束时间
	 * 
	 * @return: 返回兼职结束时间
	 */
	public Date getEnd_at() {
		return end_at;
	}

	/**
	 * 返回兼职报酬
	 * 
	 * @return: 返回兼职报酬
	 */
	public int getBenifit() {
		return benifit;
	}

	/**
	 * 返回兼职所需人数
	 * 
	 * @return: 返回兼职所需人数
	 */
	public int getCount() {
		return count;
	}

	/**
	 * 返回兼职要求
	 * 
	 * @return: 返回兼职要求
	 */
	public String getRequire() {
		return require;
	}

	/**
	 * 返回兼职信息发布商家
	 * 
	 * @return: 返回兼职信息发布商家
	 */
	public ProviderInfo getProvider() {
		return provider;
	}

	/**
	 * 返回兼职地点
	 * 
	 * @return: 返回兼职地点
	 */
	public LocationInfo getLocation() {
		return location;
	}

	/**
	 * 返回兼职信息类别
	 * 
	 * @return: 返回兼职信息类别
	 */
	public CategoryInfo getCategory() {
		return category;
	}

}
